package com.lantosec.hmrp.modules.cms.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.util.Date;

import com.lantosec.hmrp.core.mvc.BaseEntity;
import com.lantosec.hmrp.modules.cms.vo.CmsAttachmentVO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * <p>
 * CMS文章附件表 实体类
 * </p>
 *
 * @author AutoCode
 * @since 2020-07-06
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CmsAttachment extends BaseEntity<CmsAttachmentVO> {

    private static final long serialVersionUID = 1L;
    public CmsAttachment(CmsAttachmentVO vo){
        this.id = vo.getId();
        this.articleId = vo.getArticleId();
        this.uploadId = vo.getUploadId();
        this.attachmentName = vo.getAttachmentName();
        this.suffix = vo.getSuffix();
        this.editorId = vo.getEditorId();
        this.editorName = vo.getEditorName();
        this.editorTime = vo.getEditorTime();
    }

    @Override
    public CmsAttachmentVO convertToVO(){
        return new CmsAttachmentVO(this);
    }


    /**
     * 附件ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 文章ID
     */
    private Integer articleId;

    /**
     * 附件上传ID
     */
    private String uploadId;

    /**
     * 附件名称
     */
    private String attachmentName;

    /**
     * 附件后缀
     */
    private String suffix;

    /**
     * 编辑者ID
     */
    private String editorId;

    /**
     * 编辑者名称
     */
    private String editorName;

    /**
     * 编辑时间
     */
    private Date editorTime;


    public enum ColName {
        id, article_id, upload_id, attachment_name, suffix, editor_id, editor_name, editor_time, 
    }
}
